package org.wheel.plugins.toolkit.util.bean;

import cn.hutool.core.util.ReflectUtil;

import java.util.LinkedHashMap;

/**
 * 将使用Hutool工具的DynaBean类，换成自己创建的LinkHashMap同名类，减少数据转换的时间
 */
public class DynaBean extends LinkedHashMap<String, Object> {


    public static DynaBean create(Class<LinkedHashMap> linkedHashMapClass) {
        return new DynaBean();
    }

    public LinkedHashMap<String, Object> getBean() {
        return this;
    }

    public void set(String k, Object v) {
        this.put(k, v);
    }

    public Object invoke(String methodName, Object... params) {
        return ReflectUtil.invoke(this, methodName, params);
    }

    public boolean containsProp(String key) {
        return this.containsKey(key);
    }
}
